package server;

import java.util.concurrent.ConcurrentHashMap;

import common.Player;
import common.Sendable;

public class ServerStateMediator {
	
	private final ServerGameState state;
	private final Client sender;
	private final Sendable message;
	private final ConcurrentHashMap< Player, Client > clients;
	
	public ServerStateMediator( ServerGameState state, Client sender, Sendable message, ConcurrentHashMap< Player, Client > clients ) {
		this.state = state;
		this.sender = sender;
		this.message = message;
		this.clients = clients;
	}

	public ServerGameState getServerState() {
		return state;
	}
	
	public Sendable getMessage() {
		return message;
	}
	
	public Player sentBy() {
		return sender.player;
	}
	
	public Client getClient() {
		return sender;
	}
	
	public void registerPlayer( Player p ) {
		sender.player = p;
		clients.put(p, sender);
	}
}
